/*
 * RSAEncription.h
 *
 *  Created on: 12/11/2011
 *      Author: mario
 */

#ifndef RSAENCRIPTION_H_
#define RSAENCRIPTION_H_

#include <iostream>

using namespace std;
using std::string;

class RSAEncryption {
private:
	int p;
	int q;
	int n;
	long int e;
	long int d;
	int phi(int a, int b);
	int inverseMod(int phi, int d);
	int expMod(int base, int exp, int mod);
	RSAEncryption(){initialize();};
	void initialize();
	static RSAEncryption* rsaInstance;
public:
	static RSAEncryption* instance();
	static RSAEncryption* newInstance();
	string encrypt(string msg);
	string decrypt(string msg);
    long int getE() const;
    long int getD() const;
    long int getP() const;
    long int getQ() const;
    int getN() const;
};

#endif /* RSAENCRIPTION_H_ */
